$(function(){
	
	
	var petId = window.location.href.split('=')[1]
	
			$('#pageLimit').bootstrapPaginator({
				currentPage : 1,
				totalPages : 1,
				size : "normal",
				bootstrapMajorVersion : 3,
				alignment : "right",
				numberOfPages : 5,
				itemTexts : function(type, page, current) {
					switch (type) {
					case "first":
						return "首页";
					case "prev":
						return "上一页";
					case "next":
						return "下一页";
					case "last":
						return "末页";
					case "page":
						return page;
					}
				},

				onPageClicked : function(event, originalEvent, type, page) {
					console.log("1:" + page);
					
					
//					console.log(page);
				},
			});

			
	function showComms(petId,flag){
		
		console.log(petId+'---'+flag);
		
		$.getJSON('../PetComms',{
			id:petId,
			flag:flag
		},function(data,status){
			console.log('---****'+data.length);
			if(data.length!=0){
				if(flag == 1|| flag=='1'){
					$('#pet-comm').empty();
					
					for(var i=0;i<data.length;i++){
						$('#pet-comm').append('<ul class=" cart-header1"><li><span>'+data[i].VIP_NAME+'</span></li><li><span>'+data[i].MONEY+'</span></li><li><span>'+data[i].EVALUATE_CONTENT+'</span></li><li><span>'+data[i].EVALUATE_DATE+'</span></li><li><span>'+data[i].EVALUATE_STAR+'</span></li><div class="clearfix"></div></ul>');
					}
				}else{
					$('#petHis').empty();
					for(var i=0;i<data.length;i++){
						$('#petHis').append('<ul class=" cart-header1"><li><span>'+data[i].NAMES+'</span></li><li><span>'+data[i].MONEY+'</span></li><li><span>'+data[i].DATES+'</span></li><div class="clearfix"></div></ul>');
					}
				}
			}
			
			
		});
	}
	
	showComms(petId,1);
	showComms(petId,2);
	
})